<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/static/include/topLess2.jsp"%>
<script>document.title="指标选择";</script>

<script src="${baseURL}/static/js/jquery.easyui.min.js"></script>
<link href="${baseURL}/static/js/themes/default/easyui.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
table {
	margin:0;
	width:0;
	font-family:"微软雅黑";
	font-size:12px;
	color: #FFF;
	border-collapse: collapse;
}
//-->
</style>

<table id="search_t" style="width:98%">
		<tbody>
			<tr style="display: none">
				<th><img src="${ctx}/static/images/pages/cen/rig/ico_01.png" align="middle">&nbsp;指标选择
				</th>
			</tr>
			<tr class="tab_grey">
				<td>
				指标分类：
				<select id="indicatorType" name="indicatorType" class="tab_textbut_100">
					<option value="">请选择..</option>
				<c:forEach items="${indicatorType}" var="item">
					<option title="${item.codeName}" value="${item.code}">${item.codeName}</option>
				</c:forEach>
				</select>
				
				<span class="tab_text">指标名称：</span>
				<input type="text" class="tab_textbut" id="indicatorName" name="indicatorName">
				
				<span class="tab_text">上报频率：</span>
				<select id="frequency" name="frequency" class="tab_textbut">
					<option value="">请选择..</option>
					<option value="1">年报</option>
					<option value="3">半年报</option>
					<option value="2">季报</option>
				</select>

				<a class="tab_but" href="#" onclick="queryIndicator();return false;">查询</a>
				<a class="tab_but" href="#" onclick="indicatorSelect();return false;">选择</a>
				</td>
			</tr>
		</tbody>
</table>

<div id="dataList" style="overflow:auto;width:100%">
<table id="dg" class="easyui-datagrid" style="width:830px;height:360px"   
        data-options="fitColumns:true,singleSelect:true">   
    <thead>   
        <tr>
        	<th data-options="field:'id',width:20,checkbox:true">选择</th>
            <th data-options="field:'categoryName',width:120">指标分类</th>
            <th data-options="field:'name',width:300">指标名称</th>
            <th data-options="field:'code',width:60">指标代码</th>
            <th data-options="field:'unit',width:60">指标单位</th>
            <th data-options="field:'timeType',width:60">上报频率</th>
        </tr>   
    </thead>   
</table>
</div>

<script language="javaScript">

	$().ready(function(){

	});
	
	function validate(){

		return true;
	}
	
	var pageNum = 1;
	var pageSize = 10;
	function queryIndicator(){
		
		var url = "${baseURL}/audit/findIndicatorInputs";
		var params = {
				frequency:$("#frequency").val(), 
				indicatorType:$("#indicatorType").val(),
				indicatorName:$("#indicatorName").val()
		};
		
		$('#dg').datagrid({
		    url:url,
		    pagination:true,
		    pageSize:pageSize,
		    rownumbers:true,
		    queryParams:params,
		    columns:[[
				{field:'id',width:120,title:'选择', checkbox:true},
				{field:'categoryName',width:120,title:'指标分类'},
		        {field:'name',width:300,title:'指标名称'},
		        {field:'code',width:60, title:'指标代码'}, 
		        {field:'unit',width:60, title:'指标单位'},   
		        {field:'timeType',width:60,title:'上报频率'}
		    ]],
		    loadFilter: function(data){
		    	data.rows = data.operationResult;
		    	data.total = data.totalCount;
		    	return data;
			},
			onDblClickRow: function(rowIndex, rowData){
				returnIndicator(rowData.id, rowData.name);
			}
		}); 
	}
	
	function indicatorSelect(){
		var rows = $("#dg").datagrid("getChecked");
		if (rows.length==0){
			layer.alert("请选择列表中的指标项");
			return ;
		}
		returnIndicator(rows[0].id, rows[0].name);
	}
	
	function returnIndicator(id, name){
		var index = "${param['index']}";	//获取上一层子窗口的索引号
		parent.layer.getChildFrame("#indicatorName", index).val(name);
		parent.layer.getChildFrame("#indicatorId", index).val(id);
		
		closeWin();
	}
</script>




<%@ include file="/static/include/bottom.jsp"%>